body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    font-family: Tahoma, sans-serif;
    background-color: #f0f0f0;
}

body.theme-transition {
    transition: background-color 0.5s ease, color 0.5s ease;
}

.container {
    background: white;
    padding: 30px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    width: 950px;
    margin: auto;
}

textarea {
    width: 100%;
    padding: 5px;
    line-height: 1.5;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    resize: vertical;
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
    white-space: pre-wrap; /* 保持空白字符和换行符，同时在内容超出容器宽度时换行 */
    word-break: break-all; /* 允许单词内断行 */
}

.table-container::-webkit-resizer, 
textarea::-webkit-resizer {
    background: url('data:image/svg+xml;utf8,\
    <svg fill="gray" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\
      <polygon points="12,2 6,10 18,10" />\
      <polygon points="12,22 6,14 18,14" />\
    </svg>') no-repeat center center;
}

textarea:disabled {
    opacity: 0.8;
}

textarea[id="xml_urls"] {
    min-height: 122px;
}

textarea[id="channel_mappings"] {
    min-height: 142px;
}

textarea[id="gen_list_text"] {
    min-height: 147px;
}

textarea[id="sourceUrlTextarea"] {
    min-height: 102px;
}

.form-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.label-days-to-keep {
    width: 98px;
}

.custom-margin1 {
    margin-left: 195px;
}

.custom-margin2,
.custom-margin3 {
    margin-left: 70px;
}

.form-row select, 
.modal-content select,
input[type="time"] {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    width: 98px;
    height: 32px;
    margin-right: 12px;
    text-align: center;
}

input[type="time"] {
    width: 90px;
    margin-right: 0px;
}

.form-row input[id="start_time"] {
    margin-left: 292px;
}

.form-row input[id="end_time"],
select[id="interval_hour"]{
    margin-left: 44px;
}

.form-row select[id="interval_hour"], select[id="interval_minute"] {
    width: 70px;
    margin-right: 0px;
}

a, .blue-span {
    color: blue;
    cursor: pointer;
    text-decoration: none;
}

a:hover, .blue-span:hover {
    color: #0056b3;
}

.button-container {
    display: flex;
    gap: 15px;
    margin: 0 auto;
    align-items: center;
    text-align: center;
    justify-content: space-between;
}

.button-container a, .button-container button,
.modal-content button, input[type="submit"] {
    padding: 10px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
    align-items: center;
    width: 100%;
    font-size: 16px;
    font-weight: bold;
}

.button-container a:hover, .button-container button:hover,
.modal-content button:hover, input[type="submit"]:hover,
#accessStatsTable th:hover {
    background-color: #0b7dda;
}

input[type="submit"],
.button-container button[name="logoutbtn"],
.modal-content button {
    background-color: #FF9800;
    border-radius: 5px;
}

input[type="submit"]:hover,
.button-container button[name="logoutbtn"]:hover,
.modal-content button:hover {
    background-color: #e68900;
}

button[id="deleteUnusedIcons"], button[id="uploadAllIcons"], 
button[id="showAllIcons"] {
    display: flex;
    height: 36px;
}

.button-container button[name="logoutbtn"] {
    border-radius: 10px;
    width: 350px;
}

input[type="text"],
input[type="tel"] {
    width: calc(100% - 22px);
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

input[type="tel"] {
    padding: 0px;
    height: 32px;
    font-size: 15px;
    margin-bottom: 0px;
}

.flex-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.flex-item {
    width: 48%;
}

.footer {
    position: fixed;
    bottom: 10px;
    width: 100%;
    text-align: center;
}

.modal {
    display: none; /* 默认隐藏 */
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    text-align: center;
}

.modal-content {
    background-color: #fefefe;
    display: inline-block;
    padding: 20px;
    border: 1px solid #888;
    text-align: left;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
    top: 50%;
    transform: translateY(-50%);
    width: 710px;
    height: auto;
}

.version-update-modal-content,
.help-modal-content {
    padding-left: 25px;
}

.cron-log-modal-content,
.more-live-setting-modal-content {
    width: 500px;
}

.update-log-modal-content, 
.live-source-modal-content,
.access-log-modal-content,
.access-stat-modal-content {
    width: 930px;
}

.message-modal-content {
    min-width: 150px;
    width: auto;
    height: auto;
    line-height: 1.6;
}

.icon-modal-content {
    width: 700px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    cursor: pointer;
}

.table-container {
    height: 460px; /* 固定高度 */
    overflow-y: scroll; /* 启用垂直滚动条 */
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 15px;
}

.table-container[id="channel-table-container"],
.table-container[id="icon-table-container"] {
    height: 359px;
}

.table-container[id="channel-bind-epg-table-container"] {
    height: 399px;
}

.table-container[id="channel-match-table-container"] {
    height: 470px;
}

.table-container[id="live-source-table-container"] {
    height: 340px;
    min-height: 340px;
    margin-bottom: 0px;
    resize: vertical;
}

.table-container[id="access-stats-table-container"] {
    height: 467px;
}

#logTable, #channelMatchTable, #channelTable, 
#iconTable, #channelBindEPGTable, #liveSourceTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0px; /* 调整行之间的垂直间距 */
    table-layout: fixed; /* 固定表格布局，防止内容超出 */
}

#logTable, #liveSourceTable {
    border-spacing: 0 5px; /* 调整行之间的垂直间距 */
}

#logTable th, #logTable td,
#channelTable th, #channelTable td,
#iconTable th, #iconTable td,
#channelBindEPGTable th, #channelBindEPGTable td,
#channelMatchTable th, #channelMatchTable td,
#liveSourceTable th, #liveSourceTable td {
    border: 1px solid #ccc;
    padding: 5px;
    word-break: break-all; /* 允许单词内断行 */
}

#channelTable th, #channelTable td,
#iconTable th, #iconTable td,
#channelMatchTable th, #channelMatchTable td,
#channelBindEPGTable th,
#liveSourceTable th, #liveSourceTable td {
    text-align: center;
}

#logTable th:nth-child(1), 
#logTable td:nth-child(1) {
    width: 10%; /* 第一列宽度 */
    text-align: center;
}

#logTable th:nth-child(2) {
    text-align: center; /* 第二列表头居中 */
}

#channelTable th:nth-child(1),
#channelTable td:nth-child(1) {
    width: 30%; /* 第一列宽度 */
}

#iconTable th:nth-child(1),
#iconTable td:nth-child(1) {
    width: 17%; /* 第一列宽度 */
}

#iconTable th:nth-child(2),
#iconTable td:nth-child(2) {
    width: 55%; /* 第二列宽度 */
}

#iconTable th:nth-child(3),
#iconTable td:nth-child(3) {
    width: 13%; /* 第三列宽度 */
}

#channelMatchTable th:nth-child(4),
#channelMatchTable td:nth-child(4) {
    width: 15%; /* 第四列宽度 */
}

#accessStatsTableWrapper {
    overflow: auto;
    max-width: 100%;
}

#accessStatsTable {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
}

#accessStatsTable th,
#accessStatsTable td {
    border: 1px solid #ccc;
    padding: 6px;
    text-align: center;
    white-space: nowrap;
}

#accessStatsTable th {
    background-color: #2196F3;
    color: white;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 1;
}

#accessStatsTable td:first-child,
#accessStatsTable th:first-child {
    position: sticky;
}

.row {
    display: flex;
    flex-wrap: nowrap; /* 禁止换行 */
    gap: 45px;
    margin-bottom: 12px;
}

.column {
    display: flex;
    align-items: center;
    flex: 1; /* 每个列占据同等宽度 */
}

h2, span, label {
    user-select: none;
}

.row label {
    white-space: nowrap; /* 确保label不会换行 */
    margin-right: 0px;
}

.row select,
.row textarea {
    width: 100%;
    margin-right: 0px;
}

.row textarea {
    height: 32px;
    line-height: 1.3;
    white-space: nowrap; /* 禁止换行 */
    scrollbar-width: none; /* 隐藏滚动条 */
    resize: none;
}

.limited-row {
    max-height: 6em;  /* 限制约4行 */
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-all;
    transition: max-height 0.3s ease;
}
.limited-row.expanded {
    max-height: none !important;
}

/* 分页控件样式 */
#paginationContainer button {
    width: 25px;
    height: 20px;
    margin: 0 2px;
    padding: 0 0;
    color: #aaaaaa;
    background-color: #ffffff00;
    cursor: pointer;
    font-size: 15px;
}
#paginationContainer button.active, 
#paginationContainer button:hover {
    color: rgb(0, 0, 0);
}
#paginationContainer button[disabled] {
    color: #bbb;
    cursor: not-allowed;
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}
::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 4px;
    cursor: default;
}
::-webkit-scrollbar-thumb:hover {
    background-color: #ccc;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
    background-color: #f5f5f5;
    cursor: default;
}

.table-cell-disable {
    font-weight: bold;
    color: red;
    background-color: #FFFFE0;
}

.table-cell-modified {
    font-weight: bold;
    color: red;
    background-color: #DEFAFF;
}

.table-cell-clickable {
    cursor: pointer;
    user-select: none;
}

.sticky-header {
    position: sticky;
    top: 0;
    background-color: white;
}

input[type="checkbox"] {
    vertical-align: middle;
}

/* 主题切换按钮 */
.checkbox {
    opacity: 0;
    position: absolute;
}

.checkbox-label {
    float: right;
    margin-right: 5px;
    margin-top: 20px;
    background-color: #444;
    width: 40px;
    height: 16px;
    border-radius: 50px;
    position: relative;
    padding: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.5s ease;
}

.checkbox-label i {
    font-size: 18px;
    color: #f39c12;
    user-select: none;
    transition: opacity 0.5s ease;
}

.checkbox-label .ball {
    background-color: #fff;
    width: 22px;
    height: 22px;
    position: absolute;
    right: 2px; /* 小球保持在右边 */
    top: 2px;
    border-radius: 50%;
    transition: transform 0.5s ease;
}

.checkbox-label .label-text {
    font-size: 7px;
    color: #444;
    font-weight: bold;
    position: absolute;
    top: 48%;
    left: 75%;
    transform: translateX(-50%) translateY(-50%);
    z-index: 1; /* 文字位于小球上面 */
    user-select: none;
    transition: opacity 0.5s ease;
}


/* 暗色模式 */
body.dark {
    background-color: #121212;
    color: #e0e0e0;
}
  
body.dark .container,
body.dark .modal-content {
    background-color: #1e1e1e;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

body.dark textarea,
body.dark select,
body.dark input[type="text"],
body.dark input[type="time"],
body.dark input[type="tel"] {
    background-color: #333;
    color: #e0e0e0;
    border: 1px solid #555;
}

body.dark textarea:disabled {
    background-color: #222;
    color: #888;
}

body.dark a,
body.dark .blue-span {
    color: #80bfff;
}

body.dark a:hover,
body.dark .blue-span:hover {
    color: #3399ff;
}

body.dark .button-container a,
body.dark .button-container button,
body.dark #accessStatsTable th {
    background-color: #2d78b9;
    color: #e0e0e0;
}

body.dark .button-container a:hover,
body.dark .button-container button:hover,
body.dark #accessStatsTable th:hover {
    background-color: #1565c0;
}

body.dark input[type="submit"],
body.dark .button-container button[name="logoutbtn"],
body.dark .modal-content button {
    background-color: #ce7c00;
    color: #e0e0e0;
}

body.dark input[type="submit"]:hover,
body.dark .button-container button[name="logoutbtn"]:hover,
body.dark .modal-content button:hover {
    background-color: #ba7000;
}

body.dark #paginationContainer button {
    background-color: #1e1e1e;
    color: #aaa;
}

body.dark #paginationContainer button.active,
body.dark #paginationContainer button:hover {
    background-color: #333;
    color: #fff;
}

body.dark #logTable th, body.dark #logTable td,
body.dark #channelTable th,
body.dark #iconTable th, body.dark #iconTable td,
body.dark #channelBindEPGTable th, body.dark #channelBindEPGTable td,
body.dark #channelMatchTable th, body.dark #channelMatchTable td,
body.dark #liveSourceTable th {
    background-color: #2c2c2c;
    color: #e0e0e0;
}

body.dark .close:hover,
body.dark .close:focus {
    color: #e0e0e0;
}

body.dark img{
    filter: brightness(0.9);
}

body.dark ::-webkit-scrollbar-thumb {
    background-color: #555;
}

body.dark ::-webkit-scrollbar-thumb:hover {
    background-color: #666;
}

body.dark ::-webkit-scrollbar-track,
body.dark ::-webkit-scrollbar-corner {
    background-color: #2a2a2a;
}

body.dark .table-cell-disable {
    color: #ff7f7f;
    background-color: #4a4a32;
}

body.dark .table-cell-modified {
    color: #ff7f7f;
    background-color: #3b616b;
}

body.dark .checkbox-label i,
body.dark .checkbox-label .label-text {
    color: #eee;
}

body.dark .checkbox-label .ball {
    background-color: #222;
}
